<?php 
require_once './model/db.php';
require_once './model/delarticles.php';
require_once './model/articles.php';
$del = new delarticles();

        if(isset($_GET['del']))
        {
            $id = $_GET['del'];
            $del->del($id);
        }
$obj = new articles();
$data = $obj->arket();

        
?>
<div class="addsp"><a href="index_articles.php">ADD</a></div>

<table border="1" class="show">
        <tr>
            <td width="100">ID</td>
            <td width="100">Title</td>
            <td width="100">Overview</td>
            <td width="100">Body</td>
            <td  width="100">category</td>
            <td width="100"></td>
        </tr>
        <?php foreach($data as $value){ ?>
        <tr>
            <td><?php echo $value["id"] ?></td>
            <td><?php echo $value["title"] ?></td>
            <td><?php echo $value["overview"] ?></td>
            <td><?php echo $value["body"] ?></td>
            <td><?php echo $value["name"] ?></td>
            <td><a href="<?php echo "index_upda.php?id=".$value["id"]?>">EDIT</a>
                <a href="?del=<?php echo $value["id"] ?>">DELETE</a>
            </td>
        </tr>
        <?php } ?>
        
    </table>
        